<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :exportApiName="exportApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :showAttrs="showAttrs"
                :sumInfo='sumInfo'
                :optionWidth="150"
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>


<script>
import tableView from '@/components/tableView'
import basicMixins from '@/utils/commonViewMixins'
import AddOrUpdate from './financetransactioningredient-add-or-update'

export default {
  mixins: [basicMixins],
  data() {
    return {
      primaryKey: 'id',
      listApiName: 'financeApi/listFinanceTransactionIngredient',
      deleteApiName: 'financeApi/deleteFinanceTransactionIngredient',
      exportApiName: 'financeApi/getFinanceTransactionIngredientExport',
      saveAuthName: 'finance:financetransactioningredient:save',
      deleteAuthName: 'finance:financetransactioningredient:delete',
      sumInfo: {totalPrice: 'totalPrice', payableReduceAmount: 'payableReduceAmount'},

      searchAttrs: {
        supplierId: {
          label: "供应商",
          placeholder: "请输入供应商",
          type: 'autoComplete',
          querySearchApiName: 'supplierApi/getSupplierList'
        },
        ingredientId: {
          label: "货物名称",
          placeholder:"请输入货物名称",
          type: 'autoComplete',
          querySearchApiName: 'ingredientApi/getIngredientInfoList'
        },
        dateTimeRange: {
          type: 'date',
          label: '时间范围',
          dateType: 'datetimerange',
          defaultTime: ['06:00:00', '08:00:00'],
          clearable: true
        },
      },
      showAttrs: {
        dayTime: {
          label: '单据时间',
          type: 'date',
          width:120
        },
        purchaseContractNo: {
          label: '合同编号',
          width:175
        },
        paymentCycle: {
          label: '付款周期',
          width:120,
          type: 'radio',
          radioBorder: false,
          items: [
            {value: 0, text: '月结',tagType:'success'},
            {value: 1, text: '款到发货'},
            {value: 2, text: '3个月账期',tagType: 'info'},
            {value: 3, text: '付30%定金，余款70%款到发货',tagType: 'warning'},
            {value: 4, text: '2个月账期',tagType: 'danger'},
          ],
          default: 0
        },
        supplierName: {
          label: '供应商名称',
          width:180
        },

        totalPrice: {
          label: '应付增加',
          width:130
        },
        payableReduceAmount:{
          label: '应付减少',
          width:130
        },

        balancePayAmount: {
          label: '应付余额',
          width:130
        },

        transactionType: {
          label: '往来类别',
          type: 'radio',
          items: [
            {value: '应付增加', text: '应付增加', tagType: 'success'},
            {value: '应付减少', text: '应付减少', tagType: 'danger'},
          ],
          width: 110
        },
        remark: {
          label: '备注'
        },
        additionalRemark: {
          label: '附加说明'
        },
        openingBalanceAmount: {
          label: '期初金额'
        },
        // status: {
        //   label: '状态'
        // }
      }
    }
  },
  components: {
    tableView,
    AddOrUpdate
  }
}
</script>
